const createParams=function (content,params){
  Object.keys(params).forEach(item=>{
    content[item]=params[item]
  })
}
//处理多选数组
export function multipleChoiceChange(arr, value, max = -1) {
  if (!arr.includes(value)) {
    if (max == -1 || arr.length < max) {
      arr.push(value)
    } else {
      this.$message.success('最多只能选择${max}个')
    }
  } else {
    const index = arr.indexOf(value)
    arr.splice(index, 1)
  }
  return arr;
}
//处理多选对象
export function multipleChoiceChangeObj(targetName, value, vm, max = -1){
  const data=vm[targetName]
  if(!data[value.id]){
    if (max == -1 || Object.keys(data).length < max) {
      vm.$set(vm[targetName],value.id,value)
    } else {
      this.$message.success('最多只能选择${max}个')
    }
  }else{
    vm.$delete(vm[targetName],value.id)
  }
}
export default {
  createParams,
}
